package com.hwd.gmall.user.controller;

import com.hwd.gmall.common.result.Result;
import com.hwd.gmall.model.user.UserAddress;
import com.hwd.gmall.user.service.UserAddressService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户地址信息管理的控制层
 *
 * @author 黄伟东/Victor
 * @date 2022/5/4 22:05
 */
@RestController
@RequestMapping(value = "/api/user")
public class UserAddressController {

    @Resource
    private UserAddressService userAddressService;

    /**
     * 根据用户名查询用户的收获地址
     *
     * @return com.hwd.gmall.common.result.Result<java.util.List < com.hwd.gmall.model.user.UserAddress>>
     */
    @GetMapping(value = "/getUserAddress")
    public Result<List<UserAddress>> getUserAddress() {
        return Result.ok(userAddressService.listUsersAddress());
    }
}
